package com.ty.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface InventoryDao {

    @Update("update inventory set qty = qty - #{optionQty} where productId = #{productId}")
    Integer deduct(Integer productId, Integer optionQty);

    @Insert("insert into inventory_log (productId,qty) values (#{productId},#{optionQty})")
    Integer log(Integer productId, Integer optionQty);
}
